package lyttest.common.redisConnect;

import redis.clients.jedis.Jedis;

public class SingleNodeRedisConnection implements RedisConnection {
    private final Jedis jedis;

    public SingleNodeRedisConnection(String host, int port) {
        this.jedis = new Jedis(host, port);
    }

    @Override
    public String set(String key, String value) {
        return jedis.set(key, value);
    }

    @Override
    public boolean getBit(String key, Integer offset) {
        return jedis.getbit(key, offset);
    }

    @Override
    public void close() {
        if (jedis != null) {
            jedis.close();
        }
    }
}